package com.ysc.plugin.common.abstract

import android.app.Activity
import com.ysc.plugin.common.`interface`.PluginInterFace

abstract class Manager : PluginInterFace{

    private var mActivity: Activity? = null
    private var mManagerModuleMap:MutableMap<String,ManagerModule> = mutableMapOf()

    fun initialize(activity: Activity){
        mActivity = activity
        initManagerModule()
    }

    fun getActivity():Activity?{
        return mActivity
    }

    fun setActivity(activity:Activity){
        mActivity = activity
    }

    fun getManagerModule():MutableMap<String,ManagerModule>{
        return mManagerModuleMap
    }

    fun getManagerModuleByName(name:String):ManagerModule?{
        return mManagerModuleMap.get(name)
    }

    fun getManagerModuleCounts():Int{
        return mManagerModuleMap.size
    }

    abstract fun initManagerModule()

    fun addManagerModule(pluginModule: ManagerModule) {
        mManagerModuleMap.put(pluginModule.getName(),pluginModule)
    }
}